import Vue from 'vue';
import wcSwiper from 'wc-swiper';
import axios from 'axios';
import App from './App.vue';
import router from './router';
import { ACTION_ID } from '../config/action';
import 'wc-swiper/style.css';
import { isAndroid, adjustRootFontSize, scrollToActivatedEle } from './utils/utility';

// 每次活动的ACTION_ID都不一样
axios.defaults.baseURL = '/actions/' + ACTION_ID;

Vue.config.productionTip = false;
Vue.use(wcSwiper);
// 非正式环境暴露到全局，用于调试
if (process.env.NODE_ENV !== 'production') {
  window._DEBUG = {};
}

// 启动时自动调整基准字体大小
adjustRootFontSize();

// 安卓机唤起键盘时不能自动滚动到输入框，需要手动适配
if (isAndroid()) {
  window.addEventListener('resize', scrollToActivatedEle);
}

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
});
